-
Notifications
You must be signed in to change notification settings - Fork 121
Fix 'imageEdgeInsets' was deprecated in iOS 15.0 #8129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 'imageEdgeInsets' was deprecated in iOS 15.0 #8129
Conversation
| // Only for testing, switch back to true before merging | ||
| //auxiliaryButton.isHidden = true | ||
| auxiliaryButton.isHidden = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for convenience when testing the Case 2, has to be removed before merging.
ealeksandrov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if viewModel.auxiliaryButtonimage != nil { | ||
| auxiliaryButton.distributeTitleAndImage(spacing: 8.0) | ||
| var config = UIButton.Configuration.plain() | ||
| config.imagePadding = CGFloat(Constants.buttonTitleAndImageSpacing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: buttonTitleAndImageSpacing is already declared as CGFloat, no need to wrap/convert.
Applies also to 3 similar cases below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
buttonTitleAndImageSpacingis already declared asCGFloat, no need to wrap/convert. Applies also to 3 similar cases below.
Oops! Removed on 3d9760b
Good catch! I didn't see it as I was testing it in Dark Mode 🙇 This has been changed on e67f70e by leaving the |
You can test the changes from this Pull Request by:
|
ealeksandrov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.


Based on #8094 , that PR should be merged first.
Description
By updating the minimum release version to iOS 15 recently, we've seen some deprecation warnings. This PR fixes the case for
'imageEdgeInsets' was deprecated in iOS 15.0: This property is ignored when using UIButtonConfigurationOn some buttons, we rely on the
distributeTitleAndImage(_:)extension in order to add the correct padding between image and text in a UIButton. However, since we're moving to useUIButton.Configurationnow, this functionality comes for free by calling.imagePadding()instead.Changes
UIButton+TitleAndImage.imagePadding()usage to the 4 cases where we use this extension.With the change, we can also change how we do other things, like setting title or image, but this is outside of the scope of this PR, which only intends to remove the Xcode deprecation warnings. We'll leave that for a different PR :)
Testing instructions
Confirm that the following buttons still keep the same separation between Image and Text: